Skip to content

[fix] fix monitor import/export losing annotations and cron schedule …#4166

Open
Duansg wants to merge 1 commit into
apache:masterfrom
Duansg:fix-export
Open

[fix] fix monitor import/export losing annotations and cron schedule …#4166
Duansg wants to merge 1 commit into
apache:masterfrom
Duansg:fix-export

Conversation

@Duansg

@Duansg Duansg commented Jun 20, 2026

Copy link
Copy Markdown
Member

What's changed?

  1. After investigating, issue [BUG] <title>主机导出时,再重新导入,主机上已有的标签丢失 #4165 does not exist.
  2. However, other issues have arisen during the investigation: When exporting and reimporting monitoring items, annotations, scheduleType, and the cronExpression field is missing. The absence of these fields will result in missing task identifiers and incorrect task execution.

Modification details

  • Add annotations / scheduleType / cronExpression to MonitorDTO. JSON and YAML pick them up automatically via bean reflection.
  • Add the matching columns to the Excel im/export.

Checklist

  • I have read the Contributing Guide
  • I have written the necessary doc or comment.
  • I have added the necessary unit tests and all cases have passed.

Add or update API

  • I have added the necessary e2e tests and all cases have passed.

Export effect

[
  {
    "monitor": {
      "annotations": {
        "a1": "v1"
      },
      "app": "postgresql",
      "cronExpression": "0 */5 * * * ?",
      "intervals": 10,
      "labels": {
        "env": "prod",
        "key1": "val1"
      },
      "name": "test_input",
      "scheduleType": "cron",
      "status": 1
    },
    "params": [
      {
        "field": "host",
        "type": 1,
        "value": "127.0.0.1"
      },
      {
        "field": "port",
        "type": 0,
        "value": "5432"
      },
      {
        "field": "database",
        "type": 1,
        "value": "postgres"
      },
      {
        "field": "username",
        "type": 1,
        "value": "hb_expire_test"
      },
      {
        "field": "password",
        "type": 2,
        "value": "eFfcwxnlYE6y1f8QpJDjWw=="
      },
      {
        "field": "timeout",
        "type": 0,
        "value": "6000"
      },
      {
        "field": "url",
        "type": 1
      },
      {
        "field": "enableSshTunnel",
        "type": 1,
        "value": "false"
      },
      {
        "field": "sshHost",
        "type": 1
      },
      {
        "field": "sshPort",
        "type": 0,
        "value": "22"
      },
      {
        "field": "sshTimeout",
        "type": 0,
        "value": "6000"
      },
      {
        "field": "sshUsername",
        "type": 1
      },
      {
        "field": "sshPassword",
        "type": 1
      },
      {
        "field": "sshShareConnection",
        "type": 1,
        "value": "true"
      },
      {
        "field": "sshPrivateKey",
        "type": 1
      },
      {
        "field": "sshPrivateKeyPassphrase",
        "type": 1
      }
    ]
  }
]

Import effect

capcap-260620-175927

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant